package com.example.inventoryservice.company;


import java.math.BigDecimal;
import java.time.LocalDate;

public class CompanyMain {
    public static void main(String[] args) {
        IncomeTaxCalculator calculator = new IncomeTaxCalculator();

        // 1. 测试小微企业
        CompanyFinancialData smallEnterprise = new CompanyFinancialData("SMALL_ENTERPRISE",
                new BigDecimal("20000000"), // 年收入2000万
                new BigDecimal("15000000"), // 可扣除费用1500万
                50, // 员工50人
                new BigDecimal("20000000"), // 资产2000万
                LocalDate.of(2022, 1, 1) // 2022年成立
        );
        // 添加季度预缴
        smallEnterprise.addQuarterlyPrepayment(new BigDecimal("50000"));
        smallEnterprise.addQuarterlyPrepayment(new BigDecimal("50000"));
        smallEnterprise.addQuarterlyPrepayment(new BigDecimal("50000"));
        smallEnterprise.addQuarterlyPrepayment(new BigDecimal("50000"));

        TaxCalculationResult result1 = calculator.calculateTax(smallEnterprise);
        System.out.println("小微企业所得税计算结果:");
        System.out.println(result1.toString());

        // 2. 测试高新技术企业
        CompanyFinancialData highTechEnterprise = new CompanyFinancialData("HIGH_TECH_ENTERPRISE", new BigDecimal("50000000"), // 年收入5000万
                new BigDecimal("30000000"), // 可扣除费用3000万
                200, // 员工200人
                new BigDecimal("100000000"), // 资产1亿
                LocalDate.of(2018, 5, 10) // 2018年成立
        );
        highTechEnterprise.addQuarterlyPrepayment(new BigDecimal("500000"));
        highTechEnterprise.addQuarterlyPrepayment(new BigDecimal("500000"));
        highTechEnterprise.addQuarterlyPrepayment(new BigDecimal("500000"));
        highTechEnterprise.addQuarterlyPrepayment(new BigDecimal("500000"));

        // 重置计算器策略
        calculator.setStrategy(null);
        TaxCalculationResult result2 = calculator.calculateTax(highTechEnterprise);
        System.out.println("\n高新技术企业所得税计算结果:");
        System.out.println(result2.toString());

        // 3. 测试一般企业
        CompanyFinancialData generalEnterprise = new CompanyFinancialData("GENERAL_ENTERPRISE", new BigDecimal("100000000"), // 年收入1亿
                new BigDecimal("60000000"), // 可扣除费用6000万
                500, // 员工500人
                new BigDecimal("200000000"), // 资产2亿
                LocalDate.of(2015, 3, 20) // 2015年成立
        );
        generalEnterprise.addQuarterlyPrepayment(new BigDecimal("2000000"));
        generalEnterprise.addQuarterlyPrepayment(new BigDecimal("2000000"));
        generalEnterprise.addQuarterlyPrepayment(new BigDecimal("2000000"));
        generalEnterprise.addQuarterlyPrepayment(new BigDecimal("2000000"));

        // 重置计算器策略
        calculator.setStrategy(null);
        TaxCalculationResult result3 = calculator.calculateTax(generalEnterprise);
        System.out.println("\n一般企业所得税计算结果:");
        System.out.println(result3.toString());
    }
}
